package com.xsomnus.algorithm.common.timerwheel;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class SystemTimerTest {
    public static void main(String[] args) {
        SystemTimer systemTimer = new SystemTimer("timer");
        System.out.println("now " + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
        for (int i = 0; i < 15; i++) {
            if (i == 5) {
                systemTimer.add(new DelayedOperation(20000, "task g"));
                systemTimer.add(new DelayedOperation(6000, "task g"));
            }
            systemTimer.add(new DelayedOperation(500+i*1000, "task " + i));
        }
        System.out.println(System.nanoTime());
        boolean flag = true;
        while (flag) {
            boolean b = systemTimer.advanceClock(20000);
//            flag = b;
        }
    }
}
